<!--
 * @Author: whc
 * @Date: 2019-11-24 15:35:48
 * @LastEditTime: 2019-11-24 18:22:54
 -->
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,height=device-height, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body >
    <div style="display: flex; align-items: center; flex-direction: column; width: 100%; height: 800px;">
            <div style="display: flex; flex: 1; flex-direction: row; width: 100%; height: 650px;">
                    <div style="flex-grow: 1; padding: 10px;">
                        <textarea id="json" style="width: 100%; height: 100%;"></textarea>
                    </div>
                    <div style="flex-grow: 1; padding: 10px;">
                        <textarea id="model" style="width: 100%; height: 100%;"></textarea>
                    </div>
                </div>
                <button type="button" onclick="clickStartParser()">开始转换</button>
    </div>
</body>
<script src="./whc-json-to-class/whc-json-to-class.js"></script>
<script>
        {
            function clickStartParser() {
                const json = document.getElementById('json');
                if (json.value != void 0 && json.value.length > 0) {
                    const parser = new WHCJsonParser(WHCParserLanguage.Dart);
                    const result = parser.startParser(json.value);
                    const model = document.getElementById('model');
                    model.innerHTML = result[1];
                }else {
                    alert('请输入json');
                }
            }
        }
    </script>
</html>